const path = require('path')
const resolve = dir => path.join(__dirname, dir)

module.exports= {
  publicPath: './',
  chainWebpack:(config)=> {
    config.resolve.alias
        .set('views',resolve('@/views'))
        .set('components',resolve('@/components'))
        .set('api',resolve('@/api'))
        .set('config',resolve('@/config'))
        .set('const',resolve('@/const'))
        .set('router',resolve('@/router'))
        .set('store',resolve('@/store'))
  },
  devServer: {
    port: 9889,   //指定端口号以侦听
    proxy: {
      '/api': {
        ws: true,
        target: 'https://api.xiaozhucaishui.com', // 需要跨域访问的网址
        changeOrigin: true,
        pathRewrite: {
          '^/api': '/'
        }
      }
    }
  }
}
